﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Electronic_work_order.Migrations
{
    public partial class add : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "applications",
                columns: table => new
                {
                    Aid = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Aname = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_applications", x => x.Aid);
                });

            migrationBuilder.CreateTable(
                name: "expense_Reimbursement_Types",
                columns: table => new
                {
                    erTId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    erTName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_expense_Reimbursement_Types", x => x.erTId);
                });

            migrationBuilder.CreateTable(
                name: "Leave_Type",
                columns: table => new
                {
                    Leave_Type_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Leave_Type_Name = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Leave_Type", x => x.Leave_Type_ID);
                });

            migrationBuilder.CreateTable(
                name: "OrderStates",
                columns: table => new
                {
                    OrderStateID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    OrderStateName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderStates", x => x.OrderStateID);
                });

            migrationBuilder.CreateTable(
                name: "organizations",
                columns: table => new
                {
                    OrganizationID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    OrganizationName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Update_date = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_organizations", x => x.OrganizationID);
                });

            migrationBuilder.CreateTable(
                name: "PermissionStates",
                columns: table => new
                {
                    PermissionStateID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PermissionStateName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PermissionStates", x => x.PermissionStateID);
                });

            migrationBuilder.CreateTable(
                name: "Process_application_State",
                columns: table => new
                {
                    Process_State_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Process_State_Name = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Process_application_State", x => x.Process_State_ID);
                });

            migrationBuilder.CreateTable(
                name: "Purchase_Goods",
                columns: table => new
                {
                    Purchase_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Purchase_goods_Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Unit_Price = table.Column<double>(type: "float", nullable: false),
                    GoodCount = table.Column<int>(type: "int", nullable: false),
                    Subtotal = table.Column<double>(type: "float", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Purchase_Goods", x => x.Purchase_ID);
                });

            migrationBuilder.CreateTable(
                name: "Role_Permission",
                columns: table => new
                {
                    Role_Permission_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleID = table.Column<int>(type: "int", nullable: false),
                    PermissionID = table.Column<int>(type: "int", nullable: false),
                    Permission_Route = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Role_Permission", x => x.Role_Permission_ID);
                });

            migrationBuilder.CreateTable(
                name: "setmeal",
                columns: table => new
                {
                    MealID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MealName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_setmeal", x => x.MealID);
                });

            migrationBuilder.CreateTable(
                name: "UserRoles",
                columns: table => new
                {
                    RoleID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Parent_RoleID = table.Column<int>(type: "int", nullable: false),
                    RoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserRoles", x => x.RoleID);
                });

            migrationBuilder.CreateTable(
                name: "UserState",
                columns: table => new
                {
                    StateID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    StateName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserState", x => x.StateID);
                });

            migrationBuilder.CreateTable(
                name: "LeaveForm",
                columns: table => new
                {
                    LeaveID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Leave_Type_ID = table.Column<int>(type: "int", nullable: false),
                    Sex = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AuditTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LeaveMatter = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LeaveForm", x => x.LeaveID);
                    table.ForeignKey(
                        name: "FK_LeaveForm_Leave_Type_Leave_Type_ID",
                        column: x => x.Leave_Type_ID,
                        principalTable: "Leave_Type",
                        principalColumn: "Leave_Type_ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Position",
                columns: table => new
                {
                    PositionID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PositionName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ParentID = table.Column<int>(type: "int", nullable: false),
                    Grade = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Position", x => x.PositionID);
                    table.ForeignKey(
                        name: "FK_Position_organizations_ParentID",
                        column: x => x.ParentID,
                        principalTable: "organizations",
                        principalColumn: "OrganizationID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "permissions",
                columns: table => new
                {
                    PermissionID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PermissionName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PermissionStateID = table.Column<int>(type: "int", nullable: false),
                    Comments = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_permissions", x => x.PermissionID);
                    table.ForeignKey(
                        name: "FK_permissions_PermissionStates_PermissionStateID",
                        column: x => x.PermissionStateID,
                        principalTable: "PermissionStates",
                        principalColumn: "PermissionStateID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "commissions",
                columns: table => new
                {
                    Agency_ID = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ApplicationName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OrganizationId = table.Column<int>(type: "int", nullable: false),
                    Aid = table.Column<int>(type: "int", nullable: false),
                    Manager_id = table.Column<int>(type: "int", nullable: false),
                    Process_State_ID = table.Column<int>(type: "int", nullable: false),
                    Director_Id = table.Column<int>(type: "int", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_commissions", x => x.Agency_ID);
                    table.ForeignKey(
                        name: "FK_commissions_applications_Aid",
                        column: x => x.Aid,
                        principalTable: "applications",
                        principalColumn: "Aid",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_commissions_organizations_OrganizationId",
                        column: x => x.OrganizationId,
                        principalTable: "organizations",
                        principalColumn: "OrganizationID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_commissions_Process_application_State_Process_State_ID",
                        column: x => x.Process_State_ID,
                        principalTable: "Process_application_State",
                        principalColumn: "Process_State_ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "demand",
                columns: table => new
                {
                    DemandID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Stime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Rtime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OrganizationID = table.Column<int>(type: "int", nullable: false),
                    PositionID = table.Column<int>(type: "int", nullable: false),
                    num = table.Column<int>(type: "int", nullable: false),
                    cause = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    need = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Process_State_ID = table.Column<int>(type: "int", nullable: false),
                    Aid = table.Column<int>(type: "int", nullable: false),
                    ApplicationAid = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_demand", x => x.DemandID);
                    table.ForeignKey(
                        name: "FK_demand_applications_ApplicationAid",
                        column: x => x.ApplicationAid,
                        principalTable: "applications",
                        principalColumn: "Aid",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_demand_organizations_OrganizationID",
                        column: x => x.OrganizationID,
                        principalTable: "organizations",
                        principalColumn: "OrganizationID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_demand_Process_application_State_Process_State_ID",
                        column: x => x.Process_State_ID,
                        principalTable: "Process_application_State",
                        principalColumn: "Process_State_ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "expense_Reimbursements",
                columns: table => new
                {
                    erId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    erName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    erTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    OrganizationID = table.Column<int>(type: "int", nullable: false),
                    PositionID = table.Column<int>(type: "int", nullable: false),
                    erTId = table.Column<int>(type: "int", nullable: false),
                    Expense_Reimbursement_TypeerTId = table.Column<int>(type: "int", nullable: true),
                    erFY = table.Column<int>(type: "int", nullable: false),
                    erBZ = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Process_State_ID = table.Column<int>(type: "int", nullable: false),
                    Process_Application_StateProcess_State_ID = table.Column<int>(type: "int", nullable: true),
                    Aid = table.Column<int>(type: "int", nullable: false),
                    ApplicationAid = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_expense_Reimbursements", x => x.erId);
                    table.ForeignKey(
                        name: "FK_expense_Reimbursements_applications_ApplicationAid",
                        column: x => x.ApplicationAid,
                        principalTable: "applications",
                        principalColumn: "Aid",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_expense_Reimbursements_expense_Reimbursement_Types_Expense_Reimbursement_TypeerTId",
                        column: x => x.Expense_Reimbursement_TypeerTId,
                        principalTable: "expense_Reimbursement_Types",
                        principalColumn: "erTId",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_expense_Reimbursements_organizations_OrganizationID",
                        column: x => x.OrganizationID,
                        principalTable: "organizations",
                        principalColumn: "OrganizationID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_expense_Reimbursements_Process_application_State_Process_Application_StateProcess_State_ID",
                        column: x => x.Process_Application_StateProcess_State_ID,
                        principalTable: "Process_application_State",
                        principalColumn: "Process_State_ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Travel_On_Businesses",
                columns: table => new
                {
                    tbId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    tbName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    tbTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    tbSY = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OrganizationID = table.Column<int>(type: "int", nullable: false),
                    PositionID = table.Column<int>(type: "int", nullable: false),
                    tbBeginAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    tbEndAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    tbBeginTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    tbEndTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    tbJTF = table.Column<int>(type: "int", nullable: false),
                    tbZSF = table.Column<int>(type: "int", nullable: false),
                    tbCYF = table.Column<int>(type: "int", nullable: false),
                    tbSum = table.Column<int>(type: "int", nullable: false),
                    tbZB = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Process_State_ID = table.Column<int>(type: "int", nullable: false),
                    Process_Application_StateProcess_State_ID = table.Column<int>(type: "int", nullable: true),
                    Aid = table.Column<int>(type: "int", nullable: false),
                    ApplicationAid = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Travel_On_Businesses", x => x.tbId);
                    table.ForeignKey(
                        name: "FK_Travel_On_Businesses_applications_ApplicationAid",
                        column: x => x.ApplicationAid,
                        principalTable: "applications",
                        principalColumn: "Aid",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Travel_On_Businesses_Process_application_State_Process_Application_StateProcess_State_ID",
                        column: x => x.Process_Application_StateProcess_State_ID,
                        principalTable: "Process_application_State",
                        principalColumn: "Process_State_ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "ordering",
                columns: table => new
                {
                    OrderID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Otime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    OrderStateID = table.Column<int>(type: "int", nullable: false),
                    OrganizationID = table.Column<int>(type: "int", nullable: false),
                    OrName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    closing_time = table.Column<DateTime>(type: "datetime2", nullable: false),
                    MealID = table.Column<int>(type: "int", nullable: false),
                    Process_State_ID = table.Column<int>(type: "int", nullable: false),
                    Aid = table.Column<int>(type: "int", nullable: false),
                    ApplicationAid = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ordering", x => x.OrderID);
                    table.ForeignKey(
                        name: "FK_ordering_applications_ApplicationAid",
                        column: x => x.ApplicationAid,
                        principalTable: "applications",
                        principalColumn: "Aid",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_ordering_OrderStates_OrderStateID",
                        column: x => x.OrderStateID,
                        principalTable: "OrderStates",
                        principalColumn: "OrderStateID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ordering_organizations_OrganizationID",
                        column: x => x.OrganizationID,
                        principalTable: "organizations",
                        principalColumn: "OrganizationID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ordering_Process_application_State_Process_State_ID",
                        column: x => x.Process_State_ID,
                        principalTable: "Process_application_State",
                        principalColumn: "Process_State_ID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ordering_setmeal_MealID",
                        column: x => x.MealID,
                        principalTable: "setmeal",
                        principalColumn: "MealID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Users",
                columns: table => new
                {
                    UsersID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UsersName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UsersPwd = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UsersSex = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UsersPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UsersEmail = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PositionID = table.Column<int>(type: "int", nullable: false),
                    RoleID = table.Column<int>(type: "int", nullable: false),
                    EntryTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    QuitTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StateID = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Users", x => x.UsersID);
                    table.ForeignKey(
                        name: "FK_Users_Position_PositionID",
                        column: x => x.PositionID,
                        principalTable: "Position",
                        principalColumn: "PositionID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Users_UserRoles_RoleID",
                        column: x => x.RoleID,
                        principalTable: "UserRoles",
                        principalColumn: "RoleID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Users_UserState_StateID",
                        column: x => x.StateID,
                        principalTable: "UserState",
                        principalColumn: "StateID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.InsertData(
                table: "Leave_Type",
                columns: new[] { "Leave_Type_ID", "Leave_Type_Name" },
                values: new object[,]
                {
                    { 7, "补休假" },
                    { 1, "事假" },
                    { 2, "病假" },
                    { 3, "婚假" },
                    { 4, "产假" },
                    { 5, "丧假" },
                    { 6, "年休假" },
                    { 8, "其他" }
                });

            migrationBuilder.InsertData(
                table: "OrderStates",
                columns: new[] { "OrderStateID", "OrderStateName" },
                values: new object[,]
                {
                    { 1, "午餐" },
                    { 2, "晚餐" }
                });

            migrationBuilder.InsertData(
                table: "PermissionStates",
                columns: new[] { "PermissionStateID", "PermissionStateName" },
                values: new object[,]
                {
                    { 2, "禁用" },
                    { 1, "启用" }
                });

            migrationBuilder.InsertData(
                table: "Process_application_State",
                columns: new[] { "Process_State_ID", "Process_State_Name" },
                values: new object[,]
                {
                    { 3, "第一步审批成功" },
                    { 5, "未通过" },
                    { 6, "已完成" },
                    { 4, "第二步审批成功" },
                    { 1, "正在起草" },
                    { 2, "申请中" }
                });

            migrationBuilder.InsertData(
                table: "Purchase_Goods",
                columns: new[] { "Purchase_ID", "GoodCount", "Purchase_goods_Name", "Subtotal", "Unit_Price" },
                values: new object[] { 1, 100, "激光笔", 120.0, 1.2 });

            migrationBuilder.InsertData(
                table: "Role_Permission",
                columns: new[] { "Role_Permission_ID", "PermissionID", "Permission_Route", "RoleID" },
                values: new object[,]
                {
                    { 1, 1, null, 1 },
                    { 2, 2, null, 2 },
                    { 3, 3, null, 3 }
                });

            migrationBuilder.InsertData(
                table: "Travel_On_Businesses",
                columns: new[] { "tbId", "Aid", "ApplicationAid", "OrganizationID", "PositionID", "Process_Application_StateProcess_State_ID", "Process_State_ID", "tbBeginAddress", "tbBeginTime", "tbCYF", "tbEndAddress", "tbEndTime", "tbJTF", "tbName", "tbSY", "tbSum", "tbTime", "tbZB", "tbZSF" },
                values: new object[] { 1, 6, null, 1, 2, null, 2, "湖南长沙", new DateTime(2021, 4, 22, 8, 39, 57, 932, DateTimeKind.Local).AddTicks(3304), 500, "广东广州", new DateTime(2021, 4, 22, 8, 39, 57, 932, DateTimeKind.Local).AddTicks(3843), 100, "雷晴晴", "出差办事", 1600, new DateTime(2021, 4, 22, 8, 39, 57, 932, DateTimeKind.Local).AddTicks(353), "报销", 1000 });

            migrationBuilder.InsertData(
                table: "UserRoles",
                columns: new[] { "RoleID", "CreateTime", "Parent_RoleID", "RoleName" },
                values: new object[,]
                {
                    { 3, new DateTime(2021, 4, 22, 8, 39, 57, 926, DateTimeKind.Local).AddTicks(4222), 2, "普通员工" },
                    { 2, new DateTime(2021, 4, 22, 8, 39, 57, 926, DateTimeKind.Local).AddTicks(4189), 1, "主管" },
                    { 1, new DateTime(2021, 4, 22, 8, 39, 57, 924, DateTimeKind.Local).AddTicks(1739), 0, "经理" }
                });

            migrationBuilder.InsertData(
                table: "UserState",
                columns: new[] { "StateID", "StateName" },
                values: new object[,]
                {
                    { 2, "离职" },
                    { 1, "在职" }
                });

            migrationBuilder.InsertData(
                table: "applications",
                columns: new[] { "Aid", "Aname" },
                values: new object[,]
                {
                    { 6, "差旅费用申请" },
                    { 5, "报销费用申请" },
                    { 4, "订餐申请" },
                    { 3, "人员需求申请" },
                    { 2, "采购申请" },
                    { 1, "请假申请" }
                });

            migrationBuilder.InsertData(
                table: "expense_Reimbursement_Types",
                columns: new[] { "erTId", "erTName" },
                values: new object[,]
                {
                    { 1, "电话费" },
                    { 2, "交通费" },
                    { 3, "餐饮费" },
                    { 4, "其他" }
                });

            migrationBuilder.InsertData(
                table: "organizations",
                columns: new[] { "OrganizationID", "OrganizationName", "Update_date" },
                values: new object[,]
                {
                    { 4, "采购部", new DateTime(2021, 4, 22, 8, 39, 57, 928, DateTimeKind.Local).AddTicks(9201) },
                    { 1, "人事部", new DateTime(2021, 4, 22, 8, 39, 57, 928, DateTimeKind.Local).AddTicks(8578) },
                    { 2, "行政部", new DateTime(2021, 4, 22, 8, 39, 57, 928, DateTimeKind.Local).AddTicks(9183) },
                    { 3, "客户部", new DateTime(2021, 4, 22, 8, 39, 57, 928, DateTimeKind.Local).AddTicks(9198) }
                });

            migrationBuilder.InsertData(
                table: "setmeal",
                columns: new[] { "MealID", "MealName" },
                values: new object[,]
                {
                    { 4, "爆椒套餐" },
                    { 3, "清爽套餐" },
                    { 2, "双人套餐" },
                    { 1, "单人套餐" },
                    { 5, "清水套餐" },
                    { 6, "爱吃不吃套餐" }
                });

            migrationBuilder.InsertData(
                table: "LeaveForm",
                columns: new[] { "LeaveID", "AuditTime", "LeaveMatter", "Leave_Type_ID", "Sex" },
                values: new object[] { 1, "1天", "回家陪父母", 1, "男" });

            migrationBuilder.InsertData(
                table: "Position",
                columns: new[] { "PositionID", "Grade", "ParentID", "PositionName" },
                values: new object[,]
                {
                    { 12, 11, 4, "采购部职员" },
                    { 11, 10, 4, "采购部主管" },
                    { 10, 0, 4, "采购部经理" },
                    { 9, 8, 3, "客户部职员" },
                    { 7, 0, 3, "客户部经理" },
                    { 6, 5, 2, "行政部职员" },
                    { 8, 7, 3, "客户部主管" },
                    { 4, 0, 2, "行政部经理" },
                    { 3, 2, 1, "人事部职员" },
                    { 2, 1, 1, "人事部主管" },
                    { 1, 0, 1, "人事部经理" },
                    { 5, 4, 2, "行政部主管" }
                });

            migrationBuilder.InsertData(
                table: "commissions",
                columns: new[] { "Agency_ID", "Aid", "ApplicationName", "CreateTime", "Director_Id", "Manager_id", "OrganizationId", "Process_State_ID" },
                values: new object[,]
                {
                    { "2021042114", 1, "陈臣", new DateTime(2021, 4, 22, 8, 39, 57, 935, DateTimeKind.Local).AddTicks(1977), 2, 1, 1, 2 },
                    { "2021042115", 2, "陈臣", new DateTime(2021, 4, 22, 8, 39, 57, 935, DateTimeKind.Local).AddTicks(2603), 2, 1, 1, 2 }
                });

            migrationBuilder.InsertData(
                table: "demand",
                columns: new[] { "DemandID", "Aid", "ApplicationAid", "DeName", "OrganizationID", "PositionID", "Process_State_ID", "Rtime", "Stime", "cause", "need", "num" },
                values: new object[] { 1, 3, null, "杨思航", 1, 1, 2, new DateTime(2021, 4, 22, 8, 39, 57, 934, DateTimeKind.Local).AddTicks(1630), new DateTime(2021, 4, 22, 8, 39, 57, 934, DateTimeKind.Local).AddTicks(1067), "缺人", "是个人就行", 20 });

            migrationBuilder.InsertData(
                table: "expense_Reimbursements",
                columns: new[] { "erId", "Aid", "ApplicationAid", "Expense_Reimbursement_TypeerTId", "OrganizationID", "PositionID", "Process_Application_StateProcess_State_ID", "Process_State_ID", "erBZ", "erFY", "erName", "erTId", "erTime" },
                values: new object[,]
                {
                    { 2, 5, null, null, 1, 2, null, 1, "出去帮老板买饭花了200", 200, "雷晴晴", 3, new DateTime(2021, 4, 22, 8, 39, 57, 931, DateTimeKind.Local).AddTicks(6552) },
                    { 1, 5, null, null, 1, 2, null, 1, "出去帮老板做事", 200, "雷晴晴", 2, new DateTime(2021, 4, 22, 8, 39, 57, 931, DateTimeKind.Local).AddTicks(2740) }
                });

            migrationBuilder.InsertData(
                table: "ordering",
                columns: new[] { "OrderID", "Aid", "ApplicationAid", "MealID", "OrName", "OrderStateID", "OrganizationID", "Otime", "Process_State_ID", "closing_time" },
                values: new object[] { 1, 4, null, 1, "杨思航", 1, 1, new DateTime(2021, 4, 22, 8, 39, 57, 933, DateTimeKind.Local).AddTicks(3837), 1, new DateTime(2021, 4, 22, 8, 39, 57, 933, DateTimeKind.Local).AddTicks(7062) });

            migrationBuilder.InsertData(
                table: "permissions",
                columns: new[] { "PermissionID", "Comments", "PermissionName", "PermissionStateID" },
                values: new object[,]
                {
                    { 1, "最高级别的权限，可以访问所有的数据", "系统管理员", 1 },
                    { 2, "第二级别权限，可以访问第二子节点下的数据", "超级管理员", 1 },
                    { 3, "第三级别权限，只能访问自己页面", "普通管理员", 1 }
                });

            migrationBuilder.InsertData(
                table: "Users",
                columns: new[] { "UsersID", "EntryTime", "PositionID", "QuitTime", "Remarks", "RoleID", "StateID", "UsersEmail", "UsersName", "UsersPhone", "UsersPwd", "UsersSex" },
                values: new object[,]
                {
                    { 1, new DateTime(2021, 4, 22, 8, 39, 57, 929, DateTimeKind.Local).AddTicks(6149), 1, "", "", 1, 1, "abc1@qq.com", "周艳玲", "13728491578", "123456", "女" },
                    { 2, new DateTime(2021, 4, 22, 8, 39, 57, 929, DateTimeKind.Local).AddTicks(8923), 2, "", "", 2, 1, "abc2@qq.com", "雷晴晴", "13728491579", "123456", "女" },
                    { 3, new DateTime(2021, 4, 22, 8, 39, 57, 929, DateTimeKind.Local).AddTicks(8983), 3, "", "", 3, 1, "abc3@qq.com", "陈臣", "13728491576", "123456", "男" },
                    { 4, new DateTime(2021, 4, 22, 8, 39, 57, 929, DateTimeKind.Local).AddTicks(8988), 4, "", "", 1, 1, "abc4@qq.com", "杨思航", "13728491575", "123456", "女" }
                });

            migrationBuilder.CreateIndex(
                name: "IX_commissions_Aid",
                table: "commissions",
                column: "Aid");

            migrationBuilder.CreateIndex(
                name: "IX_commissions_OrganizationId",
                table: "commissions",
                column: "OrganizationId");

            migrationBuilder.CreateIndex(
                name: "IX_commissions_Process_State_ID",
                table: "commissions",
                column: "Process_State_ID");

            migrationBuilder.CreateIndex(
                name: "IX_demand_ApplicationAid",
                table: "demand",
                column: "ApplicationAid");

            migrationBuilder.CreateIndex(
                name: "IX_demand_OrganizationID",
                table: "demand",
                column: "OrganizationID");

            migrationBuilder.CreateIndex(
                name: "IX_demand_Process_State_ID",
                table: "demand",
                column: "Process_State_ID");

            migrationBuilder.CreateIndex(
                name: "IX_expense_Reimbursements_ApplicationAid",
                table: "expense_Reimbursements",
                column: "ApplicationAid");

            migrationBuilder.CreateIndex(
                name: "IX_expense_Reimbursements_Expense_Reimbursement_TypeerTId",
                table: "expense_Reimbursements",
                column: "Expense_Reimbursement_TypeerTId");

            migrationBuilder.CreateIndex(
                name: "IX_expense_Reimbursements_OrganizationID",
                table: "expense_Reimbursements",
                column: "OrganizationID");

            migrationBuilder.CreateIndex(
                name: "IX_expense_Reimbursements_Process_Application_StateProcess_State_ID",
                table: "expense_Reimbursements",
                column: "Process_Application_StateProcess_State_ID");

            migrationBuilder.CreateIndex(
                name: "IX_LeaveForm_Leave_Type_ID",
                table: "LeaveForm",
                column: "Leave_Type_ID");

            migrationBuilder.CreateIndex(
                name: "IX_ordering_ApplicationAid",
                table: "ordering",
                column: "ApplicationAid");

            migrationBuilder.CreateIndex(
                name: "IX_ordering_MealID",
                table: "ordering",
                column: "MealID");

            migrationBuilder.CreateIndex(
                name: "IX_ordering_OrderStateID",
                table: "ordering",
                column: "OrderStateID");

            migrationBuilder.CreateIndex(
                name: "IX_ordering_OrganizationID",
                table: "ordering",
                column: "OrganizationID");

            migrationBuilder.CreateIndex(
                name: "IX_ordering_Process_State_ID",
                table: "ordering",
                column: "Process_State_ID");

            migrationBuilder.CreateIndex(
                name: "IX_permissions_PermissionStateID",
                table: "permissions",
                column: "PermissionStateID");

            migrationBuilder.CreateIndex(
                name: "IX_Position_ParentID",
                table: "Position",
                column: "ParentID");

            migrationBuilder.CreateIndex(
                name: "IX_Travel_On_Businesses_ApplicationAid",
                table: "Travel_On_Businesses",
                column: "ApplicationAid");

            migrationBuilder.CreateIndex(
                name: "IX_Travel_On_Businesses_Process_Application_StateProcess_State_ID",
                table: "Travel_On_Businesses",
                column: "Process_Application_StateProcess_State_ID");

            migrationBuilder.CreateIndex(
                name: "IX_Users_PositionID",
                table: "Users",
                column: "PositionID");

            migrationBuilder.CreateIndex(
                name: "IX_Users_RoleID",
                table: "Users",
                column: "RoleID");

            migrationBuilder.CreateIndex(
                name: "IX_Users_StateID",
                table: "Users",
                column: "StateID");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "commissions");

            migrationBuilder.DropTable(
                name: "demand");

            migrationBuilder.DropTable(
                name: "expense_Reimbursements");

            migrationBuilder.DropTable(
                name: "LeaveForm");

            migrationBuilder.DropTable(
                name: "ordering");

            migrationBuilder.DropTable(
                name: "permissions");

            migrationBuilder.DropTable(
                name: "Purchase_Goods");

            migrationBuilder.DropTable(
                name: "Role_Permission");

            migrationBuilder.DropTable(
                name: "Travel_On_Businesses");

            migrationBuilder.DropTable(
                name: "Users");

            migrationBuilder.DropTable(
                name: "expense_Reimbursement_Types");

            migrationBuilder.DropTable(
                name: "Leave_Type");

            migrationBuilder.DropTable(
                name: "OrderStates");

            migrationBuilder.DropTable(
                name: "setmeal");

            migrationBuilder.DropTable(
                name: "PermissionStates");

            migrationBuilder.DropTable(
                name: "applications");

            migrationBuilder.DropTable(
                name: "Process_application_State");

            migrationBuilder.DropTable(
                name: "Position");

            migrationBuilder.DropTable(
                name: "UserRoles");

            migrationBuilder.DropTable(
                name: "UserState");

            migrationBuilder.DropTable(
                name: "organizations");
        }
    }
}
